import 'package:flutter/material.dart';
import 'package:get/get.dart';

class DefaultDialogPage extends StatelessWidget {
  const DefaultDialogPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("GetX 简单弹窗")),
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            Get.defaultDialog(
              title: "提示",
              middleText: "确定要删除吗？",
              textConfirm: "确认",
              textCancel: "取消",
              confirmTextColor: Colors.white,
              onConfirm: () {
                Get.back(); // 关闭弹窗
                Get.snackbar("结果", "已确认删除");
              },
              onCancel: () {
                Get.back(); // 关闭弹窗
                Get.snackbar("结果", "取消操作");
              },
            );
          },
          child: const Text("显示弹窗"),
        ),
      ),
    );
  }
}
